package com.xsky.logic.caseevent;

import java.util.List;

import com.xsky.common.util.UUIDUtil;
import com.xsky.common.util.XMLConverter;
import com.xsky.database.dao.impl.BaseEntityDaoImpl;
import com.xsky.operation.vo.TabCaseEventDesc;

public class CaseEventDescLogic
{
	BaseEntityDaoImpl dao = new BaseEntityDaoImpl();

	public String addCaseEventDesc(String xml)
	{
		TabCaseEventDesc caseEvent = XMLConverter.convertToObject(xml, TabCaseEventDesc.class);
		caseEvent.setCaseDescId(UUIDUtil.getUUID());
		dao.insertEntity(caseEvent);
		return "<data><result>ok</result><uuid>" + caseEvent.getId() + "</uuid><info>添加成功</info></data>";
	}


	public String updateCaseEventDesc(String xml)
	{
		TabCaseEventDesc caseEvent = XMLConverter.convertToObject(xml, TabCaseEventDesc.class);
		dao.updateEntity(caseEvent);
		return "<data><result>ok</result><uuid></uuid><info>更新成功</info></data>";
	}
	
	public List<TabCaseEventDesc> queryByCaseDescResolveId(String caseDescId){
		return dao.findByKey(new TabCaseEventDesc(), "caseDescId", caseDescId);
	}




	public void addOrUpdate(TabCaseEventDesc ced)
	{
		if(ced.getId() == null){
			ced.setId(UUIDUtil.getUUID());
		}
		dao.saveOrUpdateEntity(ced);
		
	}
	
	
}
